package com.ibeeking.found.common.enums;

public enum ChannelEnum {
    ALL("全部", 0),
    ON_LINE("线上", 1),
    OFF_LINE("线下", 2);

    private String name;
    private Integer code;

    ChannelEnum(String name, Integer code) {
        this.name = name;
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public Integer getCode() {
        return code;
    }

    public static String getNameByCode(Integer code) {
        for (ChannelEnum enumObj : values()) {
            if (enumObj.getCode().equals(code)) {
                return enumObj.getName();
            }
        }
        return null;
    }

    public static ChannelEnum getEnumByCode(Integer code) {
        for (ChannelEnum enumObj : values()) {
            if (enumObj.getCode().equals(code)) {
                return enumObj;
            }
        }
        return null;
    }
}
